﻿//var showfeeincludes = 1; //非0为只显示一个
var LineID;
var Comment = { page: 0, status: false, count: 0 };
var Consult = { page: 0, status: false, count: 0 };
var flicker, flickeri = 0;

var xOffset = 5;
var yOffset = 20;


var vipviewPrice = 1; //日历里是否显示会员价
/*弹出登陆回调*/
function AlertLoginReturn(data) {
    location = locaion;
}
function startDateLi(d) {
    if ($('#startdate li[startdate="' + d + '"]').length != 0) return;
    var obj = $(currentLP.date).find('d[date="' + d + '"]');
    var items = '';
    obj.children("c").each(function () {
        var price = toInt($(this).attr("price"));
        if (vipviewPrice == 1 && obj.attr('deluserprice') == '0') {
            var u = $(this).children('u[rankid="' + toInt(webconfig().user.rankid) + '"]');
            if (u.length > 0) price = toInt(u.attr('userprice'));
        }
        items += '，' + (price == -1 ? "电询" : "<em>&yen;" + price + '</em>元') + '/' + $(this).attr("name");
    });
    items = '<li startdate="' + d + '"><em>' + d.substring(5).replace(/-/g, '-') + '</em>出发' + items + '</li>';
    var li = $('#startdate li'), d1 = Date.parse(d.replace(/-/g, '/'));
    if (li.length > 0) {
        for (var i = 0; i < li.length; i++) {
            if (Date.parse($(li[i]).attr('startdate').replace(/-/g, '/')) > d1) {
                $(li[i]).before(items);
                return;
            }
        }
    }
    if ($('#startdate li[startdate="' + d + '"]').length == 0) {
        $('#startdate').append(items);
    }
}
function changePriceType(priceid) {
    var obj = $('#pricelist .routeItem[p_id="' + priceid + '"]');
    $('#print').attr('href', obj.attr('printurl'));
    $('#download').attr('href', obj.attr('downurl'));
    obj = $('#linePrice ul > li[p_id="' + priceid + '"]');
    if (!obj.is('.cur')) {
        $('#o_pricetype').val(priceid);
        obj.addClass('cur').siblings().removeClass('cur');
        $('#startdate').empty();
        currentLP = LP['p_' + priceid];
        var promotionObj = $('#promotioninfo').empty();
        if (currentLP.tqtype == 2) {
            $('#person').hide();
            //$('#calendarcontainer').html('自定');
            $('#startdate').html('<li>一团一价</li>');
            promotionObj.hide();
            startdateclick();
            $('#startdate li:first').click();
            return;
        } else {
            $('#person').show();
            promotionObj.show();
        }
        //获取价格
        if (currentLP.date == null) {
            currentLP.date = $.ajax({ url: webpath + 'sys/ajax/line/DatePrice.ashx', data: 'a=1&priceid=' + priceid, async: false }).responseXML;
            for (var i in currentLP.crowd) {
                $(currentLP.date).find('c[crowdid="' + currentLP.crowd[i].id + '"]').attr('name', currentLP.crowd[i].name);
            }
            LC['calendarcontainer'] = ['', '', '', $(currentLP.date).children('root').children('d'), '', '',0, function (t) {
                var d = $(t).attr('id');
                startDateLi(d);
                //添加出发日期点击事件
                startdateclick();
                $('#startdate li[startdate="' + d + '"]').click();
                var h = document.documentElement.clientHeight, p = $('#linePrice').parent().parent();
                h = (h - p.height()) / 2;
                if (h < 0) h = 0;
                $('html,body').animate({ scrollTop: p.offset().top - h }, 'slow');
                flicker = setInterval(function () {
                    flickeri++;
                    var c = flickeri % 2 ? 'red' : '';
                    var p = $('#departure .inputWrap');
                    p.css('border-color', c);
                    if (flickeri > 10) {
                        clearInterval(flicker);
                        p.css('border-color', ''); flickeri = 0;
                    }
                }, 100);
            } ];
        } else {
            LC['calendarcontainer'][3] = $(currentLP.date).children('root').children('d');
        }
        //更换营销策略
        $(currentLP.date).find('p').each(function () {
            promotionObj.append('<div class="lists clearfix" style="z-index: 1;"><div class="text"><b>惠</b>' + $(this).text() + '</div></div>');
        });
        if (promotionObj.children('div.lists').length == 0) { promotionObj.hide(); }
        //初始化日历
        CalendarPage('calendarcontainer', 0, 0);
        //添加出发日期
        obj = $(LC['calendarcontainer'][3]).filter(':lt(9)');
        if (currentLP.tqtype != 2) {
            obj.each(function () {
                startDateLi($(this).attr('date'));
            });
        }
        //更新价格列表
        var tmp = '';
        var tips = '';
        var item = '';
        var j = 100;
        tips += '<li>';
        tips += '    <div class="preHover">';
        tips += '        <p class="policyTips">优惠政策</p>';
        tips += '        <div class="preBox">';
        tips += '            <div class="box">';
        tips += '                <div class="bg"></div>';
        tips += '                <h5 class="title">优惠政策</h5>';
        tips += '                <div class="content policy">';
        tips += '                </div>';
        tips += '            </div>';
        tips += '        </div>';
        tips += '    </div>';
        tips += '</li>';
        if (currentLP.tqtype != 2) {
            for (var i in currentLP.crowd) {
                var v = currentLP.crowd[i];
                if (!!v.name) {
                    tmp += '<li class="clearfix">';
                    tmp += '      <em id="c' + v.id + '_price" style=" display:none;"></em>';
                    tmp += '      <div class="clearfix">';
                    tmp += '          <ul class="option clearfix">';
                    tmp += '              <li title="减少人数" class="decrease"><b></b></li>';
                    tmp += '              <li class="acute"><input type="text" maxlength="3" value="1" placeholder="0" class="quality" id="c' + v.id + '" name="c' + v.id + '"><span id="c' + v.id + '_text" style="display:none;">电询</span></li>';
                    tmp += '              <li title="增加人数" class="increase"><b></b></li>';
                    tmp += '          </ul>';
                    tmp += '          <label for="p1">' + v.name + '</label>';
                    tmp += '       </div>';
                    tmp += '</li>';

                    item += '    <div class="item">';
                    item += '        <h5>' + v.name + '参团：</h5>';
                    item += '        <p class="return">成功预订此产品点评后可获得<em class="porice"> ' + v.bonus + ' </em>' + webconfig().bonusunits + webconfig().bonusname + '。</p>';
                    item += '        <p class="offset">成功预订此产品可抵扣<em class="porice"> ' + v.diyong + ' </em>' + webconfig().bonusunits + webconfig().bonusname + '。</p>';
                    item += '    </div>';
                    j--;
                }
            }
            obj = $('#person');
            obj.empty().append(tmp);
            obj.append(tips);
            obj.find('.preHover .content').append(item);
            personOption();
        }

        $('.calendar td').hover( //日历鼠标经过效果
			function () {
			    if ($(this).find(".money").length > 0) {
			        $(this).addClass('hover');
			    }
			}, function () {
			    $(this).removeClass('hover');
			}
		);
        dateDrop();
        //添加出发日期点击事件
        startdateclick();
        $('#startdate li:first').click();
    }
    $('#pricelist .tabBoxNav li[v="' + priceid + '"],#feelist .tabBoxNav li[v="' + priceid + '"]').each(function () {
        if (!$(this).is('.on')) {
            var div = $(this).parents('.tabBox').find('.tabBoxContent>div').hide();
            var li = $(this).parent().children('li').removeClass('on');
            $(this).addClass('on');
            div.eq(li.index(this)).show();
            changePriceType($(this).attr('v'));
        }
        $('.routeItem .trip_nav ul').pin({//菜单跟随
            containerSelector: '.routeItem'
        });
    });
}
$(function () {
    $('.headNav').find('#line').addClass('cur');
    LineID = $('#hidelineid').val();
    //大图切换
    $(".txMovie").slide({ titCell: ".focus_nav li", mainCell: ".focus_pic", prevCell: ".navPrev", nextCell: ".navNext", autoPlay: true, delayTime: 100 });

    $('.mainBox .detailNav').pin({//菜单跟随
        containerSelector: '.mainBox'
    });
    $('.mainBox .navBox li').click(function () { //点击菜单定位到相应的位置
        var tag = $(this).attr('tag');
        var pos = $('.' + tag).offset().top - 44;
        $('.mainBox .navBox li').removeClass('active');
        $(this).addClass('active');
        $('html,body').animate({ scrollTop: pos }, 0);
    });
    $(window).scroll(function () { //菜单跟随选中
        var scrollTop = $(window).scrollTop();
        var height = $('.mainBox .navBox').height() - 0;
        if (scrollTop) {
            $('.mainBox .itemBox').each(function (i) {
                if ((scrollTop + height) >= $(this).offset().top) {
                    var myClass = $(this).attr('id');
                    $('.mainBox .navBox li').removeClass('active');
                    $('.mainBox .navBox li[tag="' + myClass + '"]').addClass('active');
                }
            });
            if (scrollTop > $('#features').offset().top) {
                $('.detailNav .booking').show();
            } else {
                $('.detailNav .booking').hide();
            }
        }
    });

    $(document).click(function (event) {  //点击空白处或者自身隐藏下拉层
        $('.dateCon').stop().hide();
    });
    var departure = $('#DepartureContainer').find('ul.departure');
    if (departure.length > 0) {
        var departuretb = '<table width="100%" cellspacing="0"><tr><td>出发时间</td><td>出发地点</td><td>返回地点</td><td>备注说明</td><td>导游旗</td></tr>';
        departure.each(function () {
            departuretb += '<tr><td>' + $(this).find('li.date').text() + '</td><td>' + $(this).find('li.addr').text() + '</td><td>' + $(this).find('li.return').text() + '</td><td>' + $(this).find('li.text').text() + '</td><td>' + $(this).find('li.flag').text() + '</td></tr>';
        }).remove();
        $('#DepartureContainer').append(departuretb + '</table> ').parent().parent().show();
    }

    var tabBoxNav = $('#feelist>.tabBoxNav');
    tabBoxNav.append('<ul class="clearfix"></ul>');
    $('#pricelist .tabBoxContent>.routeItem[p_id]').each(function (i) {
        var pid = $(this).attr('p_id');
        var tmp = $(this).parents('#pricelist').find('.tabBoxNav ul li:eq(' + i + ')');
        tmp.attr('v', pid);
        tabBoxNav.find('ul').append('<li v="' + pid + '">' + tmp.html() + '</li>');
        LP['p_' + pid] = { name: $(this).attr('p_name'), crowd: [], date: null, tqtype: $(this).attr('tqtype') };
        var ul = $(this).children('ul:first');
        ul.children('li').each(function () {
            LP['p_' + pid].crowd['i' + $(this).attr('crowdid')] = { id: $(this).attr('crowdid'), name: $(this).attr('crowdname'), text: $(this).text(), bonus: $(this).attr('bonus'), diyong: $(this).attr('diyong') };
        });
        ul.remove();
        $('#linePrice ul').append('<li p_id="' + pid + '"><a href="javascript:;"><span>' + LP['p_' + pid].name + '</span></a></li>');
        tmp = $(this).children('[name="feeincludes"]');
        var tmp1 = $(this).children('[name="feenoincludes"]');
        $('#feelist .costContent').append('<div class="item clearfix"><dl class="clearfix"><dt>费用包含</dt><dd class="reset clearfix">' + tmp.html() + '</dd></dl><dl class="clearfix"><dt>费用不包含</dt><dd class="reset clearfix">' + tmp1.html() + '</dd></dl></div>');
        tmp.remove();
        tmp1.remove();
    });
    formatTravel();
    $('#pricelist>.tabBoxNav li,#feelist>.tabBoxNav li').click(function () {
        var top = $(this).offset().top;
        changePriceType($(this).attr('v'));
        top = $(this).offset().top - top;
        $(window).scrollTop($(window).scrollTop() + top);
        $('img[data-original]').lazyload();
    });
    $('#linePrice ul > li').click(function () {
        var top = $(this).offset().top;
        changePriceType($(this).attr('p_id'));
        top = $(this).offset().top - top;
        $(window).scrollTop($(window).scrollTop() + top);
    });

    if ($('#linePrice ul > li').length == 0) {
        alert('近期暂无价格');
    } else {
        $('#linePrice ul > li:first').click();
    }
    if ($('#hideline').val() == 0) {
        $('#booking,#sbooking').click(function () {
            if (currentLP.tqtype != 2) {
                var s = 0, t = false;
                $('#person input').each(function () {
                    if ($(this).is(':visible')) {
                        t = true;
                        s += toInt($(this).val());
                    }
                });
                if (s == 0) {
                    alert(t ? '请填写出游人数!' : '请电话咨询');
                    return;
                }
            }
            var url = link['linebooking'] + 'startdate=' + $('#o_startdate').val() + '&pricetype=' + $('#o_pricetype').val() + '&' + $('#person input:visible').serialize();
            if (GetCookie('username') != '') { location = url; return; }
            ShowWindow('', '', webpath + 'BookingLogin.aspx?Page=' + URLencode(url));
        });
    } else {
        $('#booking,#sbooking').text('此线路已过期').css('backgroundColor', '#767676');
    }
    $('.review .more').click(function () {//点评更多显示
        var obj = $(this).parents('dd').find('.moreInfo');
        if (obj.is(':hidden')) {
            obj.slideDown();
            $(this).addClass('moreUp');
        } else {
            obj.slideUp();
            $(this).removeClass('moreUp');
        }
    });

});
function dateDrop() {//出发日期下拉
    $('#departure .inputWrap').unbind('click').bind('click', function (event) {
        event.stopPropagation();
        var flag = $(this).parent().find('.dateCon').is(':hidden');
        if (flag) {
            $(this).next('.dateCon').slideDown();
        } else {
            $(this).next('.dateCon').slideUp();
        }
    });

    $('#departure .dateCon li').click(function () {
        $(this).parents('.dateCon').slideUp();
        $('#departure .dateText p').html($(this).html());
    });
}
function personOption() { //人数数量操作
    $('.option .increase').click(function () {
        var num = parseInt($(this).parents('li').find('.quality').val());
        if (num >= 0 && num < 999) {
            $(this).parents('li').find('.quality').val(num + 1);
        }
    });

    $('.option .decrease').click(function () {
        var num = parseInt($(this).parents('li').find('.quality').val());
        if (num > 0 && num <= 999) {
            $(this).parents('li').find('.quality').val(num - 1);
        }
    });
}
function personOption() {//人数数量操作
    $('.option .increase').unbind("click").bind('click', function () {
        var obj = $(this).parents('li').find('.quality');
        var num = toInt(obj.val());
        obj.val(num + 1);
        var m = surplus(obj.attr('id').replace('c', ''));
        if (t > m) t = m;
        if (t < 0) t = 0;
        $(this).val(t);
        if (num >= 0 && num < 99) obj.val(num);
    });
    $('.option .decrease').click(function () {
        var obj = $(this).parents('li').find('.quality');
        var num = toInt(obj.val());
        if (num > 0 && num <= 99) {
            toInt.val(num - 1);
        }
    });
}
function startdateclick() {
    $('#startdate li').unbind().click(function () {
        $(this).parents('.dateCon').slideUp();
        $('.dateText').html('<p>' + $(this).html() + '</p><div class="bg"></div>');
        var d = $(this).attr('startdate'), zw1 = 0, zw2 = '', zw3 = '';
        if (!d) {
            $('html,body').animate({ scrollTop: $('#calendarcontainer').offset().top - 90 }, 'slow');
        } else {
            $('#o_startdate').val(d);
            $(this).addClass('cur').siblings().removeClass('cur');
            var s = 0;
            var obj = $(LC['calendarcontainer'][3]).filter('d[date="' + d + '"]'), numbercount = toInt(obj.attr('number'));
            obj.children('c').each(function () {
                var price = $(this).attr('price');
                price = price == -1 ? '电询' : '&#165;' + price, crowdid = $(this).attr('crowdid');
                $('#c' + crowdid).val(0);
                if (price == '电询') {
                    $('#c' + crowdid).parent().contents().hide();
                    $('#c' + crowdid + '_number').empty();
                    $('#c' + crowdid + '_sd').hide();
                    $('#c' + crowdid + '_text').show();
                } else {
                    $('#c' + crowdid + '_sd').show();
                    $('#c' + crowdid).prop('disabled', false).parent().contents().show();
                    $('#c' + crowdid + '_text').hide();
                    if (numbercount < 1) {
                        $('#c' + crowdid + '_number').html(0);
                        $('#c' + crowdid).val(0).prop('disabled', true).siblings('em').hide();
                    } else {
                        if (s == 0) { $('#c' + crowdid).val(1); s = 1; }
                    }
                }
            });
        }
    });
}
function surplus(c) {
    var l = currentLP, x = $(l.date);
    x = x.find('root>d[date="' + $('#o_startdate').val() + '"]');
    var numbercount = toInt(x.attr('number'));
    for (var i in l.crowd) {
        if (l.crowd[i].id != c) {
            numbercount -= toInt($('#c' + l.crowd[i].id).val());
        }
    }
    return numbercount;
}
function formatTravel() {
    $('#pricelist').find('div[name="traveldiv"]').each(function (p, n) {
        var travel = $(this).children('div[name="travel"]');
        if (travel.length == 0) {
            return;
        };
        var tmp = '', tmp1, ta, obj;
        var nav = '<div class="fl trip_nav"><ul class="clearfix">', days = travel.find('div[name="day"]');
        days.each(function (i) {
            if (i == 0) {
                nav += '<li tag="p_' + p + '_' + (i + 1) + '"><a class="cur" href="javascript:;">D1</a></li>';
            } else {
                nav += '<li tag="p_' + p + '_' + (i + 1) + '"><a href="javascript:;">D' + (i + 1) + '</a></li>';
            }
            tmp += '    <div id="p_' + p + '_' + (i + 1) + '" class="tripList p_' + p + '_' + (i + 1) + '">';
            tmp += '        <h3 class="title">';
            tmp += '            <dl class="clearfix">';
            tmp += '               <dt><span>第' + (i + 1) + '天</span></dt>';
            tmp += '               <dd>';
            tmp += '                    <div class="inner">' + $(this).find('[name="title"]:first').html() + '</div>';
            tmp += '                </dd>';
            tmp += '            </dl>';
            tmp += '        </h3>';
            var dining = $(this).find('[name="dining"]').text();
            tmp += '     <div class="trip_day">';
            tmp += '         <span class="iconEnd"></span>';
            tmp += '        <div class="dining module">';
            tmp += '            <i>&nbsp;</i>';
            tmp += '            <b>用餐：</b>';
            tmp += '            <span ' + (dining.indexOf('早餐') == -1 ? 'class="no"' : 'class="yes"') + '>早餐</span> <span ' + (dining.indexOf('中餐') == -1 ? 'class="no"' : 'class="yes"') + '>午餐</span> <span ' + (dining.indexOf('晚餐') == -1 ? 'class="no"' : 'class="yes"') + '>晚餐</span>';
            tmp += '        </div>';
            tmp += '        <div class="live module">';
            tmp += '            <i>&nbsp;</i>';
            tmp += '            <b>住宿：</b>';
            tmp += '            <span> ' + $(this).find('[name="stay"]').text() + '</span>';
            tmp += '        </div>';
            $(this).find('[name="activity"]').each(function () {
                tmp += '    <div class="travel module">';
                tmp += '        <i>&nbsp;</i>';
                tmp += '        <b>' + $(this).find('[name="title"]').text() + '</b>';
                tmp += '        <div class="travelContent reset clearfix">' + $(this).find('[name="text"]').html() + '</div>';
                tmp += '    </div>';
            });
            var sid = $(this).find('[name="sceneryid"]').text();
            if (sid != '') {
                tmp1 = '';
                ta = sid.split(',');
                for (var j = 0; j < ta.length; j++) {
                    obj = $('#citypiclist').find('[d_id="' + ta[j] + '"]');
                    if (obj.length > 0) {
                        tmp1 += '<li><a class="preview" rel="' + obj.attr('p_pics') + '" href="javascript:;" title="' + obj.attr('p_title') + '"><img width="177" height="133" alt="" src="' + webpath + 'images/loading.gif" data-original="' + obj.attr('p_pic') + '"></a><div class="bg">&nbsp;</div><div>' + obj.attr('p_title') + '</div></li>';
                    }
                }
                if (tmp1 != '') {
                    tmp += '<div class="scenic module"><i>&nbsp;</i><b>游玩景点</b><div class="scenicBox"><ul class="clearfix">' + tmp1 + '</ul></div></div>';
                }
            }
            obj = $(this).find('[name="self"]');
            if (obj.length > 0) {
                tmp += '<div class="expense module">';
                tmp += '<i>&nbsp;</i>';
                tmp += '<b>自费项目</b>';
                tmp += '<div class="expenseBox">';
                tmp += '<table width="100%" cellspacing="0"><tr><th width="200">自费项目名称</th><th width="70">参考价格</th><th>备注说明</th></tr>';
                obj.each(function () {
                    tmp += '<tr><td>' + $(this).find('[name="title"]').text() + '</td><td>' + $(this).find('[name="price"]').text() + '</td><td class="left">' + $(this).find('[name="text"]').text() + '</td></tr>';
                });
                tmp += '</table></div></div>';
            }
            obj = $(this).find('[name="shop"]');
            if (obj.length > 0) {
                tmp += '<div class="shop module">';
                tmp += '<i>&nbsp;</i>';
                tmp += '<b>购物</b>';
                tmp += '<div class="shopBox">';
                tmp += '<table width="100%" cellspacing="0"><tr><th width="200">购物信息/名称</th><th width="70">停留时间</th><th width="180">营业产品</th><th>备注说明</th></tr>';
                obj.each(function () {
                    tmp += '<tr><td>' + $(this).find('[name="name"]').text() + '</td><td>' + $(this).find('[name="stop"]').text() + '</td><td class="left">' + $(this).find('[name="product"]').text() + '</td><td class="left">' + $(this).find('[name="text"]').text() + '</td></tr>';
                });
                tmp += '</table></div></div>';
            }
            tmp += '    </div>';
            tmp += '</div>';

        });
        $(this).html(nav + '</ul></div><div class="fr trip_dayBox">' + tmp + '</div>');
    });

    $('.routeItem .trip_nav ul').pin({//菜单跟随
        containerSelector: '.routeItem'
    });
    $('.trip_nav').on('click', 'li', function () { //点击天数定位到相应的位置
        var tag = $(this).attr('tag');
        var pos = $('.' + tag).offset().top - 64;
        $(this).parent().find('a').removeClass('cur');
        $(this).find('a').addClass('cur');
        $('html,body').animate({ scrollTop: pos }, 0);
    });
    $(window).scroll(function () { //天数跟随选中
        var scrollTop = $(window).scrollTop();
        if (scrollTop) {
            var height = $('.trip_nav:visible').height();
            $('.routeItem .tripList').each(function (i) {
                if ((scrollTop + height) >= $(this).offset().top) {
                    var myClass = $(this).attr('id');
                    var myParent = $(this).parents('.routeItem');
                    myParent.find('.trip_nav li').find('a').removeClass('cur');
                    myParent.find('.trip_nav li[tag="' + myClass + '"]').find('a').addClass('cur');
                }
            });
        }
    });

    $('#pricelist .tabBoxNav').on('click', 'li', function () {//切换时执行
        var myParent = $('.trip_nav ul');
        myParent.css('position', 'initial');
        myParent.find('li a').removeClass('cur');
        myParent.find('li a:first').addClass('cur');
        $('.mainBox .detailNav').pin({//菜单跟随
            containerSelector: '.mainBox'
        });
    });
    //鼠标经过放大图片
    $("#pricelist a.preview").hover(function (e) {
        this.t = this.title;
        this.title = "";
        var c = (this.t != "") ? "<br/>" + this.t : "";
        $("body").append("<div id='preview'><img src='" + this.rel + "' alt='Image preview' />" + c + "</div>");
        var w = $('#preview').width() + e.pageX;
        var d = $('#preview').width();
        var s = document.body.clientWidth;
        $("#preview").css("top", (e.pageY - xOffset) + "px").fadeIn("fast");
        if (w > s) {
            $("#preview").css("left", (e.pageX - yOffset - d) + "px");
        } else {
            $("#preview").css("left", (e.pageX + yOffset) + "px");
        }

    },
		function () {
		    this.title = this.t;
		    $("#preview").remove();
		});

    $("#pricelist a.preview").mousemove(function (e) {
        var w = $('#preview').width() + e.pageX;
        var d = $('#preview').width();
        var s = document.body.clientWidth;
        $("#preview").css("top", (e.pageY - xOffset) + "px");
        if (w > s) {
            $("#preview").css("left", (e.pageX - yOffset - d) + "px");
        } else {
            $("#preview").css("left", (e.pageX + yOffset) + "px");
        }
    });

    $('img[data-original]').lazyload();

}
function iFrameHeight(a) {
    setTimeout("iFrameHeightTimeout('" + a + "')", 1000);
}
function iFrameHeightTimeout(a) {
    var ifm = document.getElementById(a);
    var subWeb = document.frames ? document.frames[a].document : ifm.contentDocument;
    if (ifm != null && subWeb != null) {
        ifm.height = subWeb.body.scrollHeight + 20;
    }
}
